{include file="common/_meta" /}
<title>添加管理员 - 管理员管理 - H-ui.admin v3.1</title>
<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add">
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>管理员：</label>
		<div class="formControls col-xs-8 col-sm-9">
			{if condition="$userinfo"}
			<input type="text" style="display: none;" readonly="" value="{$userinfo['id']}" name="id"/>
			{/if}
			
			<input type="text" class="input-text" value="{if condition="$userinfo"}{$userinfo['username']}{/if}" placeholder="" id="adminName" name="username">
		</div>
	</div>
	{if condition="$userinfo"}
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>原始密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off" value="" placeholder="密码" id="password" name="password">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>新密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off" value="" placeholder="密码" id="password1" name="password1">
		</div>
	</div>
	{else /}
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>初始密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off" value="" placeholder="密码" id="password" name="password">
		</div>
	</div>
	{/if}
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off"  placeholder="确认新密码" id="password2" name="password2">
		</div>
	</div>
	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">手机：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="{if condition="$userinfo"}{$userinfo['phone']}{/if}" placeholder="" id="phone" name="phone">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">邮箱：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="@" name="email" id="email" value="{if condition="$userinfo"}{$userinfo['email']}{/if}">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">角色：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="rule" size="1">
				{volist name="roles" id="r"}
				<option value="{$r['id']}" {if condition="$userinfo['uid'] eq $r['id']"} selected=""{/if}>{$r['title']}</option>
				{/volist}
			</select>
			</span> </div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">备注：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea name="" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="$.Huitextarealength(this,100)"></textarea>
			<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
		</div>
	</div>
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<a class="btn btn-primary radius"  onclick="ajaxsubmit();" >提交</a>
		</div>
	</div>
	</form>
</article>
{include file="common/_footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
	function ajaxsubmit(){
		$.ajax({
			type:'post',
			url:'{:url('admin/admin/edit')}',
			dataType:'json',
			data: $('#form-admin-add').serialize(),
			success: function(data){
				if(data.code != 200){
					layer.alert(data.msg, {icon: 2});
				}else{
					layer.msg(data.msg,{icon:1,time:1000},function(){
					window.parent.location.reload();
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
					});
				}
			},
            error: function(XmlHttpRequest, textStatus, errorThrown){
            	console.log(XmlHttpRequest, textStatus, errorThrown);
				layer.msg('error!',{icon:1,time:1000},function(){
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
			}
		});
	}

</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>